package cn.pugle.base.collect;

import java.util.TreeMap;
import java.util.function.BiConsumer;

/**
 * @author tzp
 * @since 2020/10/12
 */
public class MyTreeMapApp {
    public static void main(String[] args) {
        TreeMap<Integer, Integer> map = new TreeMap<>();
        for (int i = 1; i < 11; i++) {
            map.put(i, i);
        }
        System.out.println(map);

        map.clear();

        map.put(11, 11);
        map.put(13, 13);
        map.put(10, 10);
        map.put(12, 12);

        map.forEach(new BiConsumer<Integer, Integer>() {
            @Override
            public void accept(Integer integer, Integer integer2) {
                System.out.println(integer);
            }
        });

        for (Integer value : map.values()) {
            System.out.println(value);
        }

    }
}
